package test3;

import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class StrSort {
    public static void main(String[] args) {
        //键盘录入一个字符串
        System.out.println("输入一个字符串:");
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        //把字符串存放在字符数组
        char[] chArr = str.toCharArray();

        //创建集合对象,把字符存放到set集合中
       Set<Character> list = new LinkedHashSet<>();
        for (int i = 0; i < chArr.length; i++) {
            list.add(chArr[i]);
        }

        //2.打印出不同的那些字符，必须保证顺序
        for (Character character : list) {
            System.out.print(character);
        }

    }
}
